(use-modules (gnu)
	     (nongnu system linux-initrd)
	     (nongnu packages linux))
(use-service-modules base networking xorg linux audio)

(define %my-emacs
  (map (compose list specification->package+output)
       '("emacs-next" "emacs-geiser" "emacs-paredit" "emacs-rainbow-delimiters"
	 "emacs-guix" "emacs-rainbow-mode" "emacs-pdf-tools" "emacs-org-roam"
	 "emacs-magit" "emacs-lua-mode" "emacs-eshell-syntax-highlighting"
	 "emacs-company" "emacs-esh-autosuggest" "emacs-emms" "emacs-elfeed"
	 "emacs-disk-usage" "emacs-nov-el" "emacs-vterm")))

(define %my-media
  (map (compose list specification->package+output)
       '("ffmpeg" "mpv" "youtube-dl" "alsa-utils" "mpd" "imagemagick" "sxiv")))

(define %my-prog
  (map (compose list specification->package+output)
       '("git-minimal" "gcc-toolchain" "swi-prolog" "python" "openjdk")))

(define %my-web
  (map (compose list specification->package+output)
       '("qutebrowser")))

(define %my-xorg
  (map (compose list specification->package+output)
       '("xrandr" "xrdb" "xfontsel" "fontconfig" "font-misc-misc" "font-adobe75dpi"
	 "font-openmoji" "font-gnu-freefont" "font-gnu-unifont" "rxvt-unicode"
	 "scrot" "stumpwm" "openbox" "font-google-noto" "picom")))

(define %misc
  (map (compose list specification->package+output)
       '("htop" "p7zip" "file")))

(operating-system
 (kernel (specification->package "linux@5.10.54"))
 (kernel-arguments (cons "nomodeset"
			 (cdr %default-kernel-arguments)))
 (initrd microcode-initrd)
 (firmware (cons realtek-firmware %base-firmware))
 (bootloader (bootloader-configuration (bootloader grub-efi-bootloader)
				       (target "/boot/efi")
				       (timeout 2)))

 (file-systems (cons* (file-system (device "/dev/sda1")
				   (mount-point "/boot/efi")
				   (type "vfat"))
		      (file-system (device "/dev/sda2")
				   (mount-point "/")
				   (type "ext4"))
		      %base-file-systems))
 (swap-devices (list "/dev/sda3"))

 (host-name "z230")
 (users
  (cons (user-account (name "goth")
		      (group "users")
		      (supplementary-groups '("wheel" "audio" "video" "disk")))
	%base-user-accounts))
 (keyboard-layout (keyboard-layout "us" #:options '("ctrl:nocaps")))
 (timezone "America/New_York")
 
 (packages (append %my-emacs
		   %my-media
		   %my-prog
		   %my-web
		   %my-xorg
		   %misc
		   (list (specification->package "nss-certs"))
		   (filter
		    (lambda (x)
		      (not (or (equal? x (specification->package "nvi"))
			       (equal? x (specification->package "nano")))))
		    %base-packages)))

 (services
  (cons* (service dhcp-client-service-type)
	 (service wpa-supplicant-service-type
		  (wpa-supplicant-configuration
		   (interface "wls3")
		   (config-file "/etc/wpa_supplicant.conf")))
	 (service mpd-service-type
		  (mpd-configuration
		   (user "goth")
		   (port "6600")
		   (music-dir "~/Music")
		   (playlist-dir "~/Music/.mpd/playlists")
		   (db-file "~/Music/.mpd/tag_cache")
		   (state-file "~/Music/.mpd/state")
		   (sticker-file "~/Music/.mpd/sticker.sql")
		   (outputs
		    (list (mpd-output (type "alsa"))))))
	 (service slim-service-type
		  (slim-configuration
		   (vt "vt1")
		   (xorg-configuration
		    (xorg-configuration (keyboard-layout keyboard-layout)))))
	 %base-services)))
